<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>{$system_name}</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileColor" content="#0e90d2">
    <!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
    <!--
  <link rel="canonical" href="http://www.example.com/">
  -->
    <link rel="stylesheet" href="__PUBLIC__/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/assets/css/app.css">
    <!--<link rel="stylesheet" href="__PUBLIC__/assets/css/index.css">-->
    <!--必要样式-->
    <style>
        .agent{
            margin: 0 10px;
        }
        .agent-item{
            border-bottom: 1px solid #d4d4d4;
            padding: 10px 0 5px;
        }
        .name{
            color:#000;margin-left: 10px;
            vertical-align: middle;
            width: 100%;
        }
        .play_btn{
            font-size: 12px;
            color: #FEBF00;
            display: inline-block;
            width: 84px;
            text-align: center;
            line-height: 23px;
            background: #333;
            border-radius: 5px;
            margin: 10px 0;
        }
        .search-btn {
            color: #F6DB7F;
            display: inline-block;
            border: 2px solid #F6DB7F;
            border-radius: 10px;
            width: 45px;
            text-align: center;
            height: 32px;
            line-height: 28px;
            font-size: 15px;
        }
        .search {
            height: 30px;
            border: 1px solid #d4d4d4;
            border-radius: 5px;
            margin: 10px auto;
            width: 100%;
            padding-left: 40px;

            font-size: 12px;
            background-image: url('__PUBLIC__/assets/i/search.png');
            background-repeat: no-repeat;
            background-size: 16px;
            background-position: 18px 6px;
            color: #999;
        }
        .header-right {
            width: 65px;
            float: left;
            padding: 8px 10px 9px 10px;
        }
        .header-content {
            float: left;
            width: 250px;
            height: auto;
            margin-left: 10px;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default">
    <include file="Public:nav_left" />


    <h1 class="am-header-title">
        <a href="#title-link" class="">
            <if condition="$user_id eq $current_user_id">
                我的客户
                <else/>{$nickname}
            </if>

        </a>
    </h1>

</header>
<div class="header-content">
    <input type="search" class="search" id="search" value="{$search}" placeholder="客户ID">
</div>
<div class="header-right ">
    <a href="#"><span class="search-btn" onclick="onSerach()">搜索</span></a>
</div>
<input type="hidden" name="user_id" id="user_id" value="{$user_id}">
<div class="agent" >
    <div id="data_list">

    </div>



</div>
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default "
     id="" style="max-width: 640px;left: auto;margin-bottom: 20px;">
    <!--style="margin: 30px 0;"-->
    <div class="am-u-sm-12 am-text-center" style="background-color: #fff;line-height: 30px;" >
            <span style="color: #333;font-size: 18px;display: block">代理累计收入:<span style="color: #F00;">￥{$income}</span></span>
            <span style="color: #333;font-size: 18px">代理累计提现金额:<span style="color: #F00;">￥{$total_withdraw}</span></span>
    </div>
</div>


<!--[if (gte IE 9)|!(IE)]><!-->
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/assets/js/angular.min.js"></script>
<script src="__PUBLIC__/assets/js/amazeui.min.js"></script>
<script type="text/javascript">
    var page=1; //当前页的页码
    var allpage =1; //总页码，会从后台获取
    $(function () {
        getPromotionListByPage(1);
    });

    function scrollFn(){
        allpage = $('#totalpage').val();
        //真实内容的高度
        var pageHeight = Math.max(document.body.scrollHeight,document.body.offsetHeight);
        //视窗的高度
        var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
        //隐藏的高度
        var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
        if(pageHeight - viewportHeight - scrollHeight < 20){  //如果满足触发条件，执行
            if(page <= allpage) {
                getPromotionList();
            }
        }
    }
    $(window).bind("scroll",scrollFn);  //绑定滚动事件
    function getPromotionListByPage(pagenum) {
        //提交form
        $('#race_pagenum_hidden').val(pagenum);
        getPromotionList();
    }

    function onSerach(){
        $('#race_pagenum_hidden').val(1);
        $('#data_list').empty();
        page = 1;
        getPromotionList();
    }

    function getPromotionList() {
        var user_id = $('#user_id').val();
        var search = $('#search').val();
        $.ajax({
            type: "POST",
            url: "__URL__/ajaxPromotionList",
            async: false,
            data: {
                pagenum: page,
                user_id : user_id,
                search : search
            },
//            dataType: "json",
            success: function (data) {
//                console.info(data);
                page++;  //页数加1
                console.info('nextPage:' + page);
                $('#data_list').append(data);
            },
            error: function (data) {
                console.info(data);
            }
        });
    }
</script>
</body>
</html>

